//lambda;
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

void displayArr(vector<int>& arr)
{
    for_each(arr.begin(), arr.end(), [](int ele){
        cout << ele << endl;
    });
}

int main(int argc, char const *argv[])
{
    vector<int> arr;
    arr.push_back(1000);
    arr.push_back(500);
    arr.push_back(800);
    arr.push_back(1200);
    displayArr(arr);
    /* code */
    //降序排列打印
    cout << "sorting array in descending order" << endl;
    sort(arr.begin(), arr.end(), [](int ele1, int ele2){
        return (ele1 > ele2);
    });
    displayArr(arr);
    return 0;
}
